
{extend name="$layout" /}

{block name="content"}
{php}
    $id=input('id');
{/php}
 
        <script type="text/javascript">
        function go(sender){
            location.href="?type="+ sender.value +"&id={$id}";
        }
        </script>
        <form class="form-horizontal" onsubmit="return app.submit(this,'addpay');" id="dtest" action="" method="post">
            <div class="form-group"><label class="col-sm-2 control-label">请选择支付类型</label>
                <div class="col-sm-10">
                <select class="form-control m-b" name="type" onchange="go(this)">
                    <option value="">=请选择=</option>
                    {foreach $plugins as $key=>&$value} 
                        {if condition="$key == $type"}
                            <option value="{$key}" selected = "selected">{$value['shortdescription']}</option>
                        {else /}
                            <option value="{$key}">{$value['shortdescription']}</option>
                        {/if}
                    {/foreach} 
                </select> 
                </div>
            </div>
            <div class="form-group"><label class="col-sm-2 control-label">名称</label>
                <div class="col-sm-10">
                    <input value="{$name}" name="name" type="text" class="form-control"> 
                </div>
            </div>
            
            {foreach $data as $key=>$value} 
            <div class="form-group"><label class="col-sm-2 control-label">{$key}</label>
                <div class="col-sm-10">
                {if condition="is_bool($value)"}
                    <input name="{$key}" type="checkbox" {if condition="$value==1"}checked="true" value="true"{else /}value="false"{/if}>
                {else /}
                    <input value="{$value}" name="{$key}" type="text" class="form-control">
                {/if}  
                </div>
            </div> 
            {/foreach}  
            <div class="form-group"><label class="col-sm-2 control-label">备注</label>
                <div class="col-sm-10">
                    <input value="{$remark}" name="remark" type="text" class="form-control"> 
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-4 col-sm-offset-2">
                    <button class="btn btn-primary" type="submit">保存</button>
                    <input type="hidden" name="payid" value="{$id}" />
                </div>
            </div>
        </form>
 {/block}